package com.alliky.home.ui.adapter

import android.graphics.Paint
import android.widget.TextView
import com.alliky.common.entity.vo.HomeProductVo
import com.alliky.home.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @Author: wxianing
 * @CreateDate: 2022/3/9 21:57
 * @Description: java类作用描述
 */
class HomeProductAdapter(data: MutableList<HomeProductVo>) :
    BaseQuickAdapter<HomeProductVo, BaseViewHolder>(
        R.layout.item_home_product_layout, data
    ) {
    override fun convert(holder: BaseViewHolder, item: HomeProductVo) {
        holder.setText(R.id.tv_name, item.name)
        holder.setImageResource(R.id.iv_image, item.resId)
        holder.setText(R.id.tv_price, "￥${item.price}")
        holder.setText(R.id.tv_origin_price, "￥${item.originPrice}")
        var textView = holder.getView<TextView>(R.id.tv_origin_price)
        textView.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG
    }
}